import { createStore,applyMiddleware,combineReducers } from "redux";
import thunk from "redux-thunk";
function getReducers(){
    let files = require.context("./reducers",true,/\.js$/);
    return files.keys().reduce((pre,next)=>{
        let key = next.match(/\.\/(\w+)\.js$/)[1];
        pre[key]=files(next).default;
        return pre;
    },{})
}
let reducer = combineReducers(getReducers());
const store = createStore(reducer,applyMiddleware(thunk));
export default store;